Automatic level-of-detail for physically-based materials

ABSTRACT

A method, computer readable medium, and system are disclosed for implementing automatic level-of-detail for physically-based materials. The method includes the steps of identifying a declarative representation of a material to be rendered, creating a reduced complexity declarative representation of the material by applying one or more term rewriting rules to the declarative representation of the material, and returning the reduced complexity declarative representation of the material.

CLAIM OF PRIORITY

This application is a continuation of U.S. application Ser. No.15/599,320 (Attorney Docket No. NVIDP1151/16-BR-0219-US02), titled“Automatic Level-of-Detail for Physically-Based Materials,” filed May18, 2017, which claims the benefit of U.S. Provisional Application No.62/432,475 (Attorney Docket No. NVIDP1151+/16BR0219US01) titled“Automatic Level-of Detail for Physically-Based Materials,” filed Dec.9, 2016, the entire contents of which are incorporated herein byreference.

FIELD OF THE INVENTION

The present invention relates to physical-based rendering, and moreparticularly to reducing material complexity in a physical-basedrendering context.

BACKGROUND

Level-of-detail is used in rendering to reduce the complexity of arendering task while preserving some form of fidelity of the renderedresult. The rendering complexity is at least partially determined bygeometry, material, and lighting complexity. With physical-basedrendering, material complexity may be separated into texturing functionsand bidirectional scattering distribution functions (BSDFs).

Complex materials may be constructed using a declarative paradigm bydefining an expression that combines simple distribution function (e.g.,BRDF, BTDF, EDF, phase function) terms. However there is not currently asystem to automatically derive a simpler declarative materialrepresentation to reduce material complexity and implement levels ofdetail.

Thus, there is a need for addressing these issues and/or other issuesassociated with the prior art.

SUMMARY

A method, computer readable medium, and system are disclosed forimplementing automatic level-of-detail for physically-based materials.The method includes the steps of identifying a declarativerepresentation of a material to be rendered, creating a reducedcomplexity declarative representation of the material by applying one ormore term rewriting rules to the declarative representation of thematerial, and returning the reduced complexity declarativerepresentation of the material.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a flowchart of a method for implementing automaticlevel-of-detail for physically-based materials, in accordance with oneembodiment;

FIG. 2 illustrates an exemplary environment for implementing alevel-of-detail framework, in accordance with one embodiment;

FIG. 3 illustrates another exemplary environment for implementing alevel-of-detail framework with built-in rules, in accordance with oneembodiment;

FIG. 4 illustrates an exemplary system in which the various architectureand/or functionality of the various previous embodiments may beimplemented.

DETAILED DESCRIPTION

FIG. 1 illustrates a flowchart of a method 100 for implementingautomatic level-of-detail for physically-based materials, in accordancewith one embodiment. As shown in operation 102, a declarativerepresentation of a material to be rendered is identified. In oneembodiment, the declarative representation may include a semanticallyspecified representation of the material in a declarative programmingparadigm. For example, the declarative programming paradigm may expressthe logic of one or more computations without describing control flow.See, for example, U.S. Patent Pub. 2014/0267340 (Kettner et al.), whichis hereby incorporated by reference in its entirety.

Additionally, in one embodiment, the declarative representation mayinclude an expression tree or directed acyclic graph (DAG). In anotherembodiment, the expression tree may include a tree used to represent oneor more expressions. For example, one or more nodes of the expressiontree may each represent a function call. In another example, thefunction call may call a regular function, where regular functions maycompute a result based on a black box implementation. In anotherexample, the function call may call a distribution function, where thedistribution functions include one or more of a bidirectionalreflectance distribution function (BRDF) or a bidirectional scatteringdistribution function (BSDF). In another embodiment, the declarativerepresentation may include an expression tree, where one or more nodesof the expression tree each represent a function call or a distributionfunction including one or more of a bidirectional reflectiondistribution function (BRDF), a bidirectional transmission distributionfunction (BTDF), an emission distribution function (EDF), and a phasefunction.

Further, in one embodiment, both regular functions and distributionfunctions may be included within the expression tree. For example, allnodes above a graph-cut in the expression tree may form a declarativepart of the tree with fully defined semantics. In another example, allnodes below the graph-cut may form a set of trees that each provide avalue for a parameter of the declarative part of the tree. In yetanother example, a distribution function may have another distributionfunction and/or a regular function as an argument.

Further still, in one embodiment, the root of the expression tree mayinclude a function that takes a BSDF and a mapping vector as arguments.In another embodiment, the declarative representation of the materialmay include a material expression or a material definition that includesa defining expression, where the defining expression may be reduced byone or more rules, and where a parameter value of the definingexpression conditionally prevents a matching of one or more rules. Inyet another embodiment, the material may be rendered utilizing aphysical based rendering (PBR) model.

Also, in one embodiment, the leaves of the tree may represent one ormore values. In another embodiment, each edge of the tree may representa use of a value or function return value as an argument in a functionof a respective parent node.

In addition, as shown in operation 104, a reduced complexity declarativerepresentation of the material is created by applying one or more termrewriting rules to the declarative representation of the material. Inone embodiment, the reduced complexity declarative representation of thematerial may include a material expression having a reduced complexitywhen compared to the material expression to which the one or morerewriting rules were applied. For example, the reduced complexitydeclarative representation of the material may include an expressiontree or directed acyclic graph (DAG) having a reduced complexity.

Further still, in one embodiment, the term rewriting rules may change(e.g., rewrite, etc.) a term within the declarative representation ofthe material. For example, term rewriting may include replacingindividual subterms of an expression with other terms. It may allowrewriting an expression to meet a certain goal or set of restrictions.In another embodiment, the term rewriting rules may map the material toanother material. For example, pattern matching may be used to match anexpression (representing a structural part in the material) and replacethe expression with another expression. In another example, duringpattern matching, an expression may match another expression if theexpression is part of the other expression.

Also, in one embodiment, a plurality of term rewriting rules may beapplied to the declarative representation of the material to create thereduced complexity declarative representation of the material. Inanother embodiment, an order in which the plurality of term rewritingrules are applied may be determined. For example, the plurality of termrewriting rules may be applied in sequence. In another example, theplurality of term rewriting rules may be applied recursively.

Additionally, in one example, the expression tree may be traversed in apredetermined order, and a plurality of term rewriting rules may bematched to nodes and applied during the traversal. In another example, aplurality of term rewriting rules may be applied in all possible ordersto create a plurality of reduced complexity declarative representationsof the material, and one of the plurality of representations may beselected according to one or more predetermined criteria. In yet anotherexample, the plurality of term rewriting rules may be applied in asubset of all possible orders, using a predetermined selection strategy,to create a plurality of reduced complexity declarative representationsof the material, and one of the plurality of reduced complexitydeclarative representations of the material may be selected according toone or more predetermined criteria, where the predetermined selectionstrategy is based on greedy selection, an arbitrary cost function, orselection criteria on which rules to apply and which ones to not apply.

In another embodiment, the declarative representation may be traversedrecursively in a depth first, left to right order, and the one or moreterm rewriting rules may be matched against and applied on a currentnode of the declarative representation during traversal, wheresub-expressions of the declarative representation may be traversedrecursively after applying the one or more term rewriting rules. In yetanother embodiment, the declarative representation may be traversedrecursively in a depth first, left to right order, and the one or moreterm rewriting rules may be matched against and applied on a currentnode of the declarative representation only after all sub-expressions ofthe current node have been traversed recursively.

In another embodiment, the one or more term rewriting rules may bedetermined by defining a plurality of terminating expressions, creatinga plurality of matching patterns for all BSDFs within the declarativerepresentation, where the plurality of matching patterns enumerate allpossible combinations of how the plurality of terminating expressionscan show in parameters of the BSDFs, eliminating from the plurality ofmatching patterns those that are equal to the plurality of terminatingexpressions to create a plurality of remaining patterns, and for each ofthe plurality of remaining patterns, choosing a replacement expressionfrom the plurality of terminating expressions and defining arguments ofthe replacement expression based on arguments of a match within theremaining pattern.

Further, in one embodiment, the term rewriting rules may be applied to amaterial expression, and may create a sequence of material expressionsthat terminate with a final reduced complexity material expression. Forexample, the term rewriting rules may be designed to obtain apredetermined property or invariant for the final reduced complexitymaterial expression. In another example, the term rewriting rules may bedesigned to obtain a predetermined property or invariant for each of thesequence of material expressions as well as the final reduced complexitymaterial expression. For instance, each subsequent material expressionin the sequence may be a simplification of a preceding materialexpression in the sequence, etc. In this way, the final reducedcomplexity material expression, as well as the sequence of materialexpressions, may be created with a predetermined level of detailutilizing a single process.

Further still, in one embodiment, the term rewriting rules may bedetermined utilizing an inductive process. In another embodiment, theexpression tree may be extended to an acyclic graph representation. Inyet another embodiment, the declarative representation of the materialmay include one or more unspecified parameters. For example, a user ofthe material may provide values for the unspecified parameters. Inanother example, the declarative representation of the material may beimplemented utilizing a class structure, where the unspecifiedparameters are included in an instance of the class.

Also, in one embodiment, arguments in the expression tree may beevaluated and used in the one or more term rewriting rules. In anotherembodiment, annotations or other metadata may be included within thedeclarative representation, where the annotations or other metadata maybe used to select one or more term rewriting rules or may be used asadditional parameters during the applying of the one or more termrewriting rules to the declarative representation of the material. Inyet another embodiment, one or more term rewriting rules may be appliedto generic functions. In still another embodiment, pattern matching usedto match expressions may match multiple patterns simultaneously, andvariables may then be bound using a unification algorithm.

In addition, in one embodiment, one or more term rewriting rules mayreplace a bump map of the material with a roughness map of the material.In another embodiment, one or more term rewriting rules may approximateflakes utilizing a glossy BSDF. In yet another embodiment, one or moreterm rewriting rules may statically replace a complex high-detailmaterial with a simpler low-detail far field material. In still anotherembodiment, the expression tree may incorporate texture baking.

Furthermore, as shown in operation 106, the reduced complexitydeclarative representation of the material is returned. In oneembodiment, the reduced complexity declarative representation of thematerial may be rendered to create a visual result. In anotherembodiment, the rendering may be performed utilizing a physically basedrendering (PBR) model. In yet another embodiment, the identification ofthe declarative representation of the material to be rendered, as wellas the creation and returning of the reduced complexity declarativerepresentation of the material, may be performed by one or more hardwareprocessors (e.g., a graphics processing unit (GPU), a central processingunit (CPU), etc.), dedicated hardware, etc.

More illustrative information will now be set forth regarding variousoptional architectures and features with which the foregoing frameworkmay or may not be implemented, per the desires of the user. It should bestrongly noted that the following information is set forth forillustrative purposes and should not be construed as limiting in anymanner. Any of the following features may be optionally incorporatedwith or without the exclusion of other features described.

Level-of-Detail Framework

In one embodiment, a level-of-detail framework may apply ideas of termrewriting systems to the specific declarative expressions used to buildBSDFs and materials in a declarative language (e.g., the NVIDIA MaterialDefinition Language (MDL), etc.). One application of this idea maytransform more complex BSDF expressions into simpler BSDF expressionswhile moving the desired effect of the complex BSDF expression into thetextures that feed into the parameters of the simpler BSDF expression.In the following, we introduce the framework and how it may besystematically used.

Framework

In this section, we define in more detail declarative expressions andhow rules of a term-rewriting system may operate on them. We define arepresentative subset of the declarative expression language of MDL andexplain how term-rewriting rules may operate on these expressions tocreate a sequence of materials of less-and-less detail, which ends, forexample, in a single diffuse BRDF. We further explore variants andextensions of the basic idea.

Declarative Expressions to Define Physically-Based Materials

For the sake of clarity of the initial exposition of our ideas, we startwith a simplified material model ignoring transparency, emission, andvolumetric effects. They may be handled analogously. We model aphysically-based material as an expression tree, which can be extendedto a directed-acyclic graph as described later. The tree may consist offunction calls as nodes in the tree and values in the leaves of thetree. An edge in the tree may denote the use of a value or a functionreturn value as an argument in the function of its respective parentnode.

One exemplary distinction between the declarative material definitionand the procedural language to define texturing materializes in thisexpression tree as two kind of nodes: regular functions and distributionfunctions.

Regular functions may compute a result from their arguments based on anunknown (black box) implementation. These functions may thus beimplemented, for example, with a procedural language without impactingthe benefits of the declarative part. However, the functions may beassumed to be pure, i.e., side-effect free. Additionally, they mayaccess render state, such as position, normal, UV texture spaces, etc.,which may be treated as an always present implicit parameter.

Dealing only with the surface scattering behavior of a material in thebeginning, the distribution functions are BRDFs (which may be extendedto BSDFs). In contrast to the regular functions, their behavior(although not their implementations) may be fully specified and knownwith their semantic.

Regular functions may not have distribution functions as arguments.Distribution functions may have other distribution functions and regularfunctions as arguments. We furthermore use a dedicated function M as theroot of the expression tree with one BSDF and further arguments. It maybe part of the declarative definition.

The distinction between the declarative part and the regular functionsmay create a graph-cut in this expression tree. All nodes above the cutmay form a tree with fully defined semantics. All remaining nodes belowthe cut may form a forest, a set of trees with each tree providing avalue for a parameter of the declarative part.

This may allow us to analyze the meaning of a composition ofdistribution functions in the upper tree and transform them to adifferent one while understanding the impact of that transformation. Wemay do this in distinction to other simplification methods on thishigh-level tree representation. In our notations, we will use upper caseletters to denote distribution functions, and lower case letters forregular functions and values.

Table 1 illustrates the dedicated function M that is the root of anexpression tree, as well as associated arguments, in accordance with oneembodiment. Of course, it should be noted that the root and associatedarguments shown in Table 1 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 1

 (B, n) Arg Definition B Bidirectional Scattering Distribution Function(BSDF) n normal mapping vector, default is the normal n_(s) in therender state

Table 2 illustrates distribution functions (BSDFs) for use in top levelsof the expression tree, in accordance with one embodiment. Of course, itshould be noted that the BSDFs shown in Table 2 are set forth forillustrative purposes only, and thus should not be construed as limitingin any manner.

TABLE 2 BSDF Definition elemental 0 Null BSDF, which renders black. D(c,r) Lambertian reflection extended by the Oren-Nayar microfacet model[ON95] with a color tint c and roughness r. S(c) Specular reflectionwith a color tint c. G(c, r_(u), r_(v), t) Glossy reflection based on amicrofacet model [WMLT07] using a Phong distribution [AS00] and av-cavities shadowing term [Hd14] with a color tint c and anisotropicroughnesses in u-direction along the tangent t, r_(u), and v-direction,r_(v). The Phong distribution exponent e is computed as e = 2/r².modifier T(c, B) Tint a base BSDF B with the color c. mixer W(w₀, A₀, .. .) Weighted sum of BSDFs, w_(i) ≥ 0 and Σ w_(i) ≤ 1 layerer L(w, A, B,n) Weighted layering, wA + (1 − w)B, and a normal map n applied to toplayer A. F(i, w, A, B, n) Fresnel layering, w′A + (1 − w′)B where w′ =w * fresnel(i) is a weighted, IOR-dependent Fresnel term, and a normalmap n applied to top layer A.

Table 3 illustrates arguments used within the distribution functions, inaccordance with one embodiment. Of course, it should be noted that thearguments shown in Table 3 are set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 3 Arg Definition c a color value for tint r roughness in theOren-Nayar reflectance model r_(u) roughness in the microfacet model inu-direction r_(v) roughness in the microfacet model in v-direction ttangent vector to define the u-direction for anisotropy i index ofrefraction (IOR) w, w₀, . . . scalar weights in [0, 1] A, B BSDFs nnormal vector for local normal perturbation

Table 4 illustrates an example MDL material that defines a simpleplaster material based on a 0.7 gray color for the tint of a diffuseBRDF, in accordance with one embodiment. Of course, it should be notedthat the MDL material shown in Table 4 is set forth for illustrativepurposes only, and thus should not be construed as limiting in anymanner.

TABLE 4 material plaster ( ) = material (   surface: material_surface (   scattering: df::diffuse_reflection_bsdf (      tint: color(0.7)    )  ) );

Table 5 illustrates an exemplary function expression M that conciselyexpresses the MDL material in Table 4 using the notations from Table1-3, in accordance with one embodiment. Of course, it should be notedthat the function expression shown in Table 5 is set forth forillustrative purposes only, and thus should not be construed as limitingin any manner.

TABLE 5

 (D(0.7, 0.0), n_(s))

In one embodiment, transmission and more exotic BSDFs, such asretro-refractive or measured BSDFs, may be added following the sameprinciples as for the other BSDFs.

Rules Operating on Expressions

Given an expression, we may define rules to rewrite a term in thisexpression and replace it with another term. In its most general form, arule may include a map that maps one material M to some other materialM′. More specifically, we may use pattern matching to match a certainstructural part in a material and replace that part by anotherexpression. Such a rule may only be applicable on a material if thatmaterial has a sub-expression matching this pattern.

Patterns may include expressions with distribution functions and theymay match an expression if its own expression is part of the matchedexpression. To be more universally useful, patterns may also usevariables, which match arbitrary sub-expressions and may later be usedin the replacement expression. For example, D(c, r) may define a patternmatching the diffuse BSDF defined above with the variables c for thetint color and r for the roughness parameters of this BSDF.

The pattern F(i, w, S(c), B, n) may match all specular BSDFs that areFresnel layered over an arbitrary base BSDF B. The variables in thepattern may be used in the replacement expression. In addition, we mayallow standard algebraic operations and functions in the replacementexpression.

Table 6 illustrates an exemplary rule with the pattern on the left andthe replacement expression on the right, in accordance with oneembodiment. Of course, it should be noted that the exemplary rule shownin Table 6 is set forth for illustrative purposes only, and thus shouldnot be construed as limiting in any manner.

TABLE 6 W(w₁, D(c₁, r₁), w₂, D(c₂, r₂)) 

 D(w₁c₁ + w₂c₂, w₁r₁ + w₂r₂)

As shown in Table 6, the rule may implement a transformation thatreplaces a weighted mix of two diffuse BRDFs by a single diffuse BRDFwhose parameters are weighted sums of the respective input parameters.This rule may be intuitively right for the color parameter butapproximate for the roughness parameter. Additional rules andapproximations may be subject to the individual rule sets in specificapplication scenarios.

Pattern matching may be more powerful and may restrict certainparameters to be of a certain value including dependencies on othervariables. Table 7 illustrates a restriction of the rule in Table 6 toonly match diffuse BRDFs of equal roughness r, in accordance with oneembodiment. Of course, it should be noted that the exemplary restrictionshown in Table 7 is set forth for illustrative purposes only, and thusshould not be construed as limiting in any manner.

TABLE 7 W(w₁, D(c₁, r), w₂, D(c₂, r)) 

 D(w₁c₁ + w₂c₂, r)

We may use additional variables in the target expression for a concisenotation where needed and define their values later. Table 8 illustratesan alternate notation for the rule restriction in Table 7, in accordancewith one embodiment. Of course, it should be noted that the alternatenotation shown in Table 8 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 8 W(w₁, D(c₁, r), w₂, D(c₂, r)) 

 D(c′, r), where c′ = w₁c₁ + w₂c₂

In general, one may extend this scheme to multiple patterns. Oneimportant case may include the possible cross interaction of parts ofthe material model, such as normal maps, with parts of the BSDFs, likethe local normal maps of the layering BSDFs. Since the material modelfunction (M) may always be the root of the expression tree, we maysimplify the notation of matching (M) and may allow rules to make directuse of all arguments of (M), which is n in this case, includingassigning new expressions to them.

For example, we may move the local normal map of a weighted layering tothe global normal map respecting the weight of the layer. Note thatn_(s) is the surface normal in the render state and the default for thenormal map. We may give this rule an additional precondition that itonly applies if n₁≠n_(s), which may be an optimization avoidingidempotent transformations in this case.

Table 9 illustrates this normal map movement and precondition, inaccordance with one embodiment. Of course, it should be noted that thenormal map movement shown in Table 9 is set forth for illustrativepurposes only, and thus should not be construed as limiting in anymanner.

TABLE 9 L(w, A, B, n₁) 

 L(w, A, B, n_(s)), n 

 f_(n)(1, n, w, n₁), if n₁ ≠ n_(s)

In one embodiment, as shown in Table 9, ƒ_(n)(w₁; n₁, . . . ) mayinclude a function that scales normal maps according to weights andblends them together. Table 10 illustrates a case with two normals, inaccordance with one embodiment. Of course, it should be noted that thecase with two normals shown in Table 10 is set forth for illustrativepurposes only, and thus should not be construed as limiting in anymanner.

TABLE 10 f_(n)(w₁, n₁, w₂, n₂) = normalize(n_(s) + w₁(n₁ − n_(s)) +w₂(n₂ − n_(s)))

Term-Rewriting System as a Level-of-Detail Scheme

Given a set R of term-rewriting rules, there may be a question as towhich order matching rules will be applied in the case where multiplerules are applicable at the same time. This question is important in twocontexts: correctness and efficiency. For correctness properties, suchas a termination proof or that a rule system always results in aspecific standard material model, a proof independent of the ruleapplication order may be possible. Such a rule system is calledconfluent. This may then be used to implement efficient evaluationorders without affecting correctness. More complex rule systems andtheir desired properties may need more controlled ordering. A fewpossibilities are listed below.

Multiple Rule Sets

A system may use multiple rule sets in sequence. Rule sets applied firstmay establish invariants that later rule sets can rely on, such as theelimination of a specific BSDF.

Recursive Application of Rule Sets

A system with multiple rule sets that are run in sequence. However,later rules may re-introduce elements that require an earlier rule setto be applied again, typically in a recursive fashion on a subtree.Giving rules a priority and always executing rules of higher priorityfirst may be a version of this scheme.

Pre-Order Traversal

The expression tree may be traversed recursively in a depth-first and,e.g., left-to-right order. Rules may be matched against and applied onthe current node. After rule application, sub-expressions may betraversed recursively. This evaluation order may be useful to establisha certain property top-down in the tree.

Post-Order Traversal

The expression tree may be traversed recursively in a depth—first and,e.g., left-to-right order. Rules may be matched against the current nodeonly after all its sub-expression have been traversed recursively. Thisevaluation order may be useful to establish a certain property bottom-upin the tree.

Exhaustive Enumeration

All matching rules may be applied as different alternatives, exploringall possibilities of results that can achieved with this rule system.This exhaustive enumeration of all materials that one can derive from aninput material may allow one to pick the best material according to somearbitrary optimality criterion. For typical materials the top-level ofthe expression tree and the number of applicable rules may be small, sothis approach may be used in that case.

Partial Enumeration

Instead of exhaustive enumeration, one may steer the enumeration to asubset with strategies such as a greedy selection of the best rule orset of rules or an A*-search to prune search space.

Applying rule after rule from a rule set R to a material expression Mcreates a sequence of materials M₁ to M_(n). For a practical system, wemay want this process to terminate. Such a rule system may then reduce amaterial expression M to a final expression M′. For a confluent rulesystem, M′ may be unique irrespective of the order of rule applications.

Table 11 illustrates this chain of derivation, in accordance with oneembodiment. Of course, it should be noted that the chain of derivationshown in Table 11 is set forth for illustrative purposes only, and thusshould not be construed as limiting in any manner.

TABLE 11

We may design a rule system with the goal in mind that the resultingfinal expression M′ fulfills a particular property or invariant. We mayalso design a rule system with the goal in mind that the whole sequenceof material expressions M₁ to M_(n), or subsequence thereof, fulfills aparticular property, such that each material is a simplification of itspreceding material.

Suitable rule systems may therefore be a simple and efficient means tocreate one level-of-detail material or a whole sequence oflevel-of-detail materials in one process. We may associate a cost toeach rule which quantifies the approximation error and we may useexhaustive or partial enumeration to create derivation chains or finalresults where the aggregation of costs along the derivation chain isminimal, i.e., the simplification incurs the least possibleapproximation error. The costs may themselves be approximate, and theymay be dependent on actual parameter values of the current expressionmatching the rule.

Table 12 illustrates a rule system R_(tint) which may remove all tintmodifiers T(c,B) from material expressions by pushing the tint color cfrom the BSDFs to the regular functions level, in accordance with oneembodiment. For example, a tint of a diffuse BSDF may be equivalent to adiffuse BRDF with the tint color factored into its tint parameter. Ofcourse, it should be noted that the rule system shown in Table 12 is setforth for illustrative purposes only, and thus should not be construedas limiting in any manner.

TABLE 12 $_{tint} = \begin{Bmatrix}{T( {c,0} )} & \mapsto & {0,} \\{T( {c_{1},{D( {c_{2},r} )}} )} & \mapsto & {{D( {{c_{1}c_{2}},r} )},} \\{T( {c_{1},{S( c_{2} )}} )} & \mapsto & {{S( {c_{1}c_{2}} )},} \\{T( {c_{1},{G( {c_{2},r_{u},r_{v},t} )}} )} & \mapsto & {{G( {{c_{1}c_{2}},r_{u},r_{v},t} )},} \\{T( {c_{1},{T( {c_{2},A} )}} )} & \mapsto & {{T( {{c_{1}c_{2}},A} )},} \\{T( {c,{W( {w_{1},A_{1},{.\;.\;.}}\mspace{11mu} )}} )} & \mapsto & {{W( {w_{1},{T( {c,A_{1}} )},{.\;.\;.}}\mspace{11mu} )},} \\{T( {c,{L( {w,A,B,n} )}} )} & \mapsto & {{L( {w,{T( {c,A} )},{T( {c,B} )},n} )},} \\{T( {c,{F( {i,w,A,B,n} )}} )} & \mapsto & {F( {i,w,{T( {c,A} )},{T( {c,B} )},n} )}\end{Bmatrix}$

This rule system may be an example of a confluent rule system.Independent of the order of rule application, all tint colors may end upmultiplied to the tint parameters of elemental BSDFs. An efficientevaluation strategy may be pre-order traversal, pushing the tintmodifiers from top to bottom where they disappear. Proving correctnessand termination is obvious from the complete case enumeration of allBSDFs as arguments of the tint modifier, i.e., as long as a tintmodifier is in the material expression, we may find a matching rule andeach rule application makes progress in pushing the tint modifier to aleaf or eliminates it at a leaf.

Table 13 illustrates a systemic method for finding suitable rules, inaccordance with one embodiment. Of course, it should be noted that themethod shown in Table 13 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 13 1. We define the terminating expressions, those that should notsimplify any further. 2. For each possible node type, e.g., all BSDFs,we create matching patterns where we enumerate all possible combinationsof how the terminating expressions can show in the parameters of thenode type. 3. We eliminate from the patterns those that are equal to theterminating expressions from step 1. 4. For each of the remainingpatterns, we choose one replacement expression from the list ofterminating expressions and define the arguments of the replacementexpression based on arguments of the match.

There may be many ways to find suitable rules. The method shown in Table13 may be inductive and may be based on complete enumeration in a waythat allows an efficient bottom-up post-order traversal evaluation and asimple proof of correctness.

This systematic approach may reduce the problem of finding a suitablerule set to the smaller problems of defining suitable targets anddefining best replacements for the systematically defined rule set. Thisreduction to a single rule where the pattern is rather specific mayallow a simpler and more focused reasoning of what a good targetexpression is and what best arguments would be. The examples below makeuse of this approach.

Variants and Extensions

One idea described herein is the framework of representing a material asa semantically specified expression and applying a term-rewriting systemto create a final expression, or a sequence of expressions on the way tothe final expression. The following describe variants and extensions tothis principle.

Acyclic Graphs

The expression trees used to define a material may be extended to anacyclic graph representation by allowing a way to give sub-expression aname and use those names instead of expressions in other places. Cyclesmay be prevented in this representation and can, for example, be ruledout with a definition-before-use restriction on those names withoutlosing generality.

Material Classes

Material expressions may be fully defined with values for eachparameter. However, material definitions in MDL (a.k.a material class)may allow a user to program materials with additional parameters thatare left unspecified, until a user of this material provides values forthose parameters later, creating a material instance from the materialclass. Rule systems may be easily applied to material expressions thatinclude placeholders for yet unspecified parameters. They might not beas effective, for example, if a parameter variable is a distributionfunction. An effective solution may restrict material classes to haveonly variables for nodes that are not distribution function.

Evaluating Generic Functions

When working with material instances, we may evaluate the arguments inthe expression tree and use that information in rules. For example, arule could remove a BSDF in a mixer or layerer, if its weight is below acertain threshold. We may evaluate uniform arguments fully beforerendering starts. For varying arguments, such as expressions withprocedural or bitmap textures, we may sample the domain to obtain arepresentative value or use interval arithmetic to obtain bounds on apossible value range and use those for decision making. See, forexample, “Automatic bounding of programmable shaders for efficientglobal illumination” (Velazquez-Armendariz et al.), which is herebyincorporated by reference in its entirety.

User Annotations

The system may be extended to incorporate annotations that MDL materialauthors or users can leave in the material and that the rules can use inthe match. Such annotations may give, for example, a hint which BSDF ismore important than another BSDF. A specific annotation may just add afloating point value as an importance weight on each BSDF. A rule cansee that weight as an additional argument in each BSDF and use it todecide which BSDF to keep and which one to throw away.

In one embodiment, the system may be extended to incorporate metadataassociated with a material that material authors or users can define forthe material and that the rules can use in the match. Such metadata maybe included in a material in the form of annotations.

Rules on Generic Functions

Similar replacement rules may be defined and applied on genericfunctions if those functions have specified semantics. Candidates couldbe standard libraries, for example, for texture lookups andtransformations, where a rule system could be devised to transformcomplex texture networks into a more efficient canonical textureprocessing pipeline.

Unification

The pattern matching part of the rule system may be extended to matchmultiple patterns at the same time and then use the unificationalgorithm known from Prolog to bind variables.

Besides these variants and extensions to the basic framework, it isworth mentioning that other existing ideas around materialsimplification may be integrated into this framework, for example,leading to rules with high approximation qualities. Some examples areshown below.

Approximating Bump Maps by Roughness Maps

A rule may replace the bump map n of a material by a suitable roughnessmap of the respective material BSDF, such as a glossy BSDF

Approximating Car-Paint Flakes by Glossy Far-Field Look

A car-paint with flakes may be approximated by a glossy BSDF thatmatches a far field look of the flakes.

Procedural Multi-Scale Materials

A procedural shading model may be used for real-time LOD evaluation.See, for example, “Real-time rendering of procedural multiscalematerials” (Zirr et al.), which is hereby incorporated by reference inits entirety. Ideas from that model may be used to statically replace acomplex high-detail material with a simpler low-detail far fieldmaterial.

Texture Baking

The above framework may suggest that the complexity in the declarativepart of the material expression, the distribution functions, issimplified with rules, and possibly at the cost of adding complexity tothe regular functions part of the material expression. Depending on thetarget and the specific rule system, this may be sufficient, e.g., ifthe target execution context allows for programmable functions.

However, in other contexts, this may not be sufficient. We discuss inthis section briefly the option to use texture baking as complementarytechnique to augment our framework. Note also that the use of texturebaking is orthogonal to this framework, which may be used with orwithout baking without change.

If we remove the declarative part of the material expression, we areleft with a forest, a set of trees, each tree providing a value for aparameter of the declarative part. Each tree may now be baked into itsown texture. Baking may evaluate the sub-expression at suitable settingsof the render state, such as uv-coordinates or object space coordinatesif projectors play a role, and store the result in a texture. A bakingsolution may depend on the complexity and smartness of heuristicsdeployed and possibly augmented with user control to select size andresolutions of textures.

System Integrations

An integration of this framework may include several parts. Some partshave a variety of choices how they are realized in a particular system.FIG. 2 shows an exemplary environment 200 for implementing alevel-of-detail framework, according to one embodiment.

As shown, the environment 200 includes an expression tree or DAG in adeclarative material model 202 that is input to a runtime scheduler 212.In one embodiment, the material model 202 may include a sufficientlyformal defined declarative representation that can be expressed as atree or DAG. In another embodiment, the runtime scheduler 212 may applyrule sets 214 to the declarative material model 202 in an executionframework 204. The runtime scheduler 212 may manage the high-levelexecution strategy, in which order rule sets and individual rules aretested for a match and executed.

Additionally, the execution framework 204 may be used to apply rules 214to material expressions 202. This may be a custom solution for aspecific set of rules, or a generic framework, which would allowdifferent rule sets. As shown, the rule sets may be flexibly changed, upto late customization in applications and as end-user accessiblefeature.

Further, the rule sets 214 may include a set of rules accomplishing adesired effect. In one embodiment, the rule sets 214 may accomplishreductions to fixed material models. The rules within the rule sets 214may imply an approximation of the material, which may include a judgmentof what to optimize for. Those judgments may be delayed by making themparameters of the rules and giving the users of the rule set the choiceto set those parameters.

Further still, rule sets defined in a domain specific language 208 aretranslated utilizing using a rule translator 210 and saved within theset of rules 214. In one embodiment, the rule sets defined in the domainspecific language 208 may be created utilizing a notation to definerules and their effect. This may range from an implementation of therules in the execution framework itself, and it may include an exposedapplication program interface (API) to allow developers to implementrules independent of the execution framework, and it may even be adomain specific language (DSL) to allow users to develop their ownrules, or to manage existing rule sets.

Also, the rule translator 210 makes rules executable with the executionframework. This may include the native application's compiler for an APIapproach, or a custom compiler for a DSL approach.

Additionally, the environment 200 includes a texture baker 206 thatincludes baked constants 216 and baked textures 218. In one embodiment,texture baking or runtime execution may be used to handle genericfunction expressions. Their implementation and quality may be orthogonalto the framework of the environment 200.

Further, after applying the rule sets 214 to the material expressions202, the runtime scheduler 212 outputs an expression tree or DAG of atarget material model 220.

FIG. 3 illustrates another exemplary environment 300 for implementing alevel-of-detail framework with built-in rules, according to oneembodiment. As shown, the environment 300 includes an expression tree orDAG in a declarative material model 202 that is input to a materialsimplifier 302. The material simplifier 302 includes the runtimescheduler 212 as well as the rule sets 214 and the execution framework204.

After applying the rule sets 214 to the material expressions 202 in theexecution framework 204, the runtime scheduler 212 outputs an expressiontree or DAG of a target material model 220. The environment 300 alsoincludes the texture baker 206 that includes baked constants 216 andbaked textures 218.

In this way, the runtime scheduler 212, rule sets 214, and the executionframework 204 may all be included within the material simplifier 302,which may form a monolithic system.

Results for Example Rule Systems

In one embodiment, we may define example rule sets, discuss theirproperties, and determine how they perform on a larger set of materialdefinitions.

One rule system may reduce each material to a single diffuse BRDF withone texture for its tint color. This may be a useful target for amaterial level-of-detail, and it may be used as a first approximation inediting viewports where applications might not have a lot of flexibilityin showing materials.

Local normal maps may play a role for the look of various materials. Wemay develop a rule system to aggregate local normal maps to oneapproximated global normal map.

Another rule system may reduce each material to a kind of dielectricmaterial, a Fresnel-layered glossy BRDF over a diffuse BRDF. This may bean intermediate step in a level-of-detail representation. Additionally,this framework may target such a material, for example, in a game engineor other applications favoring a fixed material model over aprogrammable one.

Reduction to a Single Diffuse BRDF

In one embodiment, we may simplify a material to a single diffuse BSDFwith the following rule set in a post-order traversal. As aprerequisite, we may run the rule system R_(tint) first to eliminate alltint modifiers.

Table 14 illustrates a rule set for reduction to a single diffuse BRDF,in accordance with one embodiment. Of course, it should be noted thatthe rule set shown in Table 14 is set forth for illustrative purposesonly, and thus should not be construed as limiting in any manner.

TABLE 14 $_{diff} = \begin{Bmatrix}0 & \mapsto & {D( {0.0,0.0} )} \\{S(c)} & \mapsto & {D( {c,0.0} )} \\{G( {c,r_{u},r_{v},t} )} & \mapsto & {D( {c,0.0} )} \\{W( {w,{D( {c,r} )}} )} & \mapsto & {D( {{wc},r} )} \\{W( {w_{1},{D( {c_{1},r_{1}} )},\; {.\;.\;.}}\mspace{11mu} )} & \mapsto & {D( {{{w_{1}c_{1}} + \; {.\;.\;.}}\mspace{14mu},{f_{dr}( {w_{1},r_{1},\; {.\;.\;.}}\mspace{11mu} )}} )} \\{L( {w,{D( {c_{1},r_{1}} )},{D( {c_{2},r_{2}} )},n} )} & \mapsto & {W( {w,{D( {c_{1},r_{1}} )},{1 - w},{D( {c_{2},r_{2}} )}} )} \\\; & \mapsto & {D( {{{wc}_{1} + {( {1 - w} )c_{2}}},{f_{dr}( {r_{1},r_{2}} )}} )} \\{F( {i,w,{D( {c_{1},r_{1}} )},{D( {c_{2},r_{2}} )},n} )} & \mapsto & {L( {{{f_{F}(i)}w},{D( {c_{1},r_{1}} )},{D( {c_{2},r_{2}} )},n} )} \\\; & \mapsto & {D( {{{{f_{F}(i)}{wc}_{1}} + {( {1 - {{f_{F}(i)}w}} )c_{2}}},{f_{dr}( {r_{1},r_{2}} )}} )}\end{Bmatrix}$

In one embodiment, ƒ_(dr) may include a suitable function to blend thediffuse roughness values, and ƒ_(F) may include a suitable function ofhow much of the Fresnel-layered top BSDF we want to blend into the baselayer, which may depend on the IOR value i of the layering.

The function ƒ_(dr) may be, for example, the maximum roughness value oran affine weighted sum like for the color values.

The function ƒ_(F) may be the reflectivity of the Fresnel term at normaldirection, e.g., 0.04 for a typical IOR of 1.5. This may be a suitablevalue arguing that typically large parts of an object face us and only asmall fraction is viewed at grazing angles. However, if the goal wouldnot be a best look approximation but whether all features are visible,we may want to make this value larger so that possible texturing effectsin the top layer remain recognizable. A default in experiments below mayinclude a constant value of 0.1.

Correctness: Unless the expression consists of a single diffuse BRDF,there is always a rule that is matching. This is based on the completeenumeration of all cases of BSDFs excluding the terminating expression(the diffuse BSDF). By bottom-up induction it further suffices for aBSDF with other BSDFs as arguments if the matching pattern just matchesthe terminating diffuse BSDF for those arguments.

The rule system terminates with a finite number of steps (and results inthe single diffuse BRDF then). We argue with an integer cost function,which is the sum of all cost values that we associate with each BSDFnode: 0, S, and G nodes cost two, and D, W, L, and F nodes cost one. Amaterial expression has thus an integral cost, which is linear in thenumber of nodes. The cost is greater or equal to one, and only one if itis a single diffuse BRDF. Each rule application reduces the cost by atleast one. After a linear number of rule applications, we reach theterminating case.

The post-order traversal may result in an efficient evaluation of thisrule system with its bottom-up application of rules.

Handling of a Local Normal Map

The rule set R_(diff) in the previous section may ignore the localnormal maps n of the respective rules that match weighted layering (L( .. . )) and Fresnel layering (F( . . . )). Instead, we may transfer thelocal normal map to the global normal map, respecting the weights thatinfluence the layer with the local normal map.

We may accomplish this by introducing a new distribution function N, akind of place-holder that only represents the current local normal mapn: N(n).

We may then use a similar rule system as for the diffuse target materialthat aggregates the local normal maps to a single one, best bottom-up ina postorder traversal. Note that n_(s) may be the default shading normalin the render state, and ƒ_(n) (w₁, n₁, . . . ) may include a functionthat scales normal maps according to weights and blends them together.

Table 15 illustrates a rule set for handing a local normal map, inaccordance with one embodiment. Of course, it should be noted that therule set shown in Table 15 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 15 $_{norm} = \begin{Bmatrix}0 & \mapsto & {{N( n_{s} )},} \\{D( {c,r} )} & \mapsto & {{N( n_{s} )},} \\{S(c)} & \mapsto & {{N( n_{s} )},} \\{G( {c,r_{u},r_{v},t} )} & \mapsto & {{N( n_{s} )},} \\{W( {w_{1},{N( n_{1} )},\; {.\;.\;.}}\mspace{14mu} )} & \mapsto & {{N( {f_{n}( {w_{1},n_{1},\; {.\;.\;.}}\mspace{14mu} )} )},} \\{L( {w,{N( n_{1} )},{N( n_{2} )},n} )} & \mapsto & {{N( {f_{n}( {w,n,{1 - w},n_{2}} )} )},} \\{F( {i,w,{N( n_{1} )},{N( n_{2} )},n} )} & \mapsto & {N( {f_{n}( {{{f_{F}(i)}w},n,{1 - {{f_{F}(i)}w}},n_{2}} )} }\end{Bmatrix}$

The result of applying the rules in FIG. 15 may include a single localnormal map that may be combined with the global normal map of thematerial model. Note that the behavior of the layering BSDFs in MDL maybe different than what is encoded in R_(norm) if multiple layerers arenested.

The system is fast for practical material complexities and may bedeployed in real-time editing contexts working on material instances. Itmay bridge the gap between a rich material model and the fixed materialmodels common in game engines and editing viewports.

Term Rewriting for Materials—Algebraic Explanation

The declarative definition of the distribution function part of aphysical-based material model may be represented as an expression treein an algebra that consists of all distribution functions specified inthe language and the operations to combine them. Argument values for thedistribution function parameters may be determined by literal values andfunction call graphs. Directed acyclic call graphs may be handled byunrolling them to a tree.

A rule for a term rewriting system may consist of a pattern that canmatch a sub-expression in the declarative part of the expression tree,and a replacement expression. Table 16 illustrates an exemplary rule, inaccordance with one embodiment. Of course, it should be noted that therule set shown in Table 16 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 16 mix(w₁, diff(c₁), w₂, diff(c₂)) → diff(w₁c₁ + w₂c₂)

The rule in Table 16 may include a simple example for a pattern that maymatch a weighted mix of two colored diffuse distribution functions andreplace it with a single diffuse distribution function with weightedcolor arguments.

Table 17 illustrates an exemplary application of rules to materialexpressions, in accordance with one embodiment. Of course, it should benoted that the application shown in Table 17 is set forth forillustrative purposes only, and thus should not be construed as limitingin any manner.

TABLE 17

As shown in Table 17, given a suitable set

of rules and applying rule after rule to an initial material expressionM₁ creates a sequence of materials, where assuming termination,

reduces M₁ to a final expression M_(n). Term rewriting may be a simpleand efficient means to create one simplified material M_(n) or a wholesequence <M₁> for a level-of-detail representation created in oneprocess.

Creating Suitable Sets of Rewriting Rules—Algebraic Explanation

Important questions for a term rewriting system and its set of rules mayinclude termination, confluence (e.g., does there exist a unique normalform where no rule applies anymore), and runtime efficiency. Evaluationstrategies for efficient systems may be top-down or bottom-up.

In particular, a bottom-up evaluation strategy may lead to a systematicprocess of deriving a rule set whose correctness follows easily byinduction. We start by defining the normal forms that are terminalstates in the derivation chain, such as a single diffuse material, or amaterial model used.

Table 18 illustrates an exemplary process to derive a rule system, inaccordance with one embodiment. Of course, it should be noted that theprocess shown in Table 18 is set forth for illustrative purposes only,and thus should not be construed as limiting in any manner.

TABLE 18 (1) Define the set of normal form expressions 

 . (2) For all distribution functions D of the language and combinationsof how normal forms in 

 can be used as arguments for the parameters of D, create a matchingpattern. (3) Eliminate patterns that are equal to a normal form in 

 . (4) For each of the remaining patterns, choose a normal form from 

 that is a good replacement expression and define its arguments based onarguments of the match. The choice of the normal form and its argumentscan introduce approximations and give room for optimizations.

Rules, like the example above in Table 18, may transfer complexity fromthe declarative expression to the regular function call graph. Otherrules might lower total complexity by just picking parts with thehighest weight. Function call graph complexity may be further reducedwith the complementary and orthogonal technique of texture baking, i.e.,evaluating function subgraphs over a suitable domain and replacing thesubgraph with a simple bitmap texture lookup. Rules can be complementedwith partial evaluation, where functions are evaluated or sampled atsimplification time.

The resulting value may control rule behavior or be baked for use atrender time. The ideas presented here apply analogously to all kinds ofdistribution functions, such as for transmission, emission, volumeeffects, as well as other parts of a material, such as normal maps, andgeneral function call graphs, assuming their components are specified asalgebra.

FIG. 4 illustrates an exemplary system 400 in which the variousarchitecture and/or functionality of the various previous embodimentsmay be implemented. As shown, a system 400 is provided including atleast one central processor 401 that is connected to a communication bus402. The communication bus 402 may be implemented using any suitableprotocol, such as PCI (Peripheral Component Interconnect), PCI-Express,AGP (Accelerated Graphics Port), HyperTransport, or any other bus orpoint-to-point communication protocol(s). The system 400 also includes amain memory 404. Control logic (software) and data are stored in themain memory 404 which may take the form of random access memory (RAM).

The system 400 also includes input devices 412, a graphics processor406, and a display 408, i.e. a conventional CRT (cathode ray tube), LCD(liquid crystal display), LED (light emitting diode), plasma display orthe like. User input may be received from the input devices 412, e.g.,keyboard, mouse, touchpad, microphone, and the like. In one embodiment,the graphics processor 406 may include a plurality of shader modules, arasterization module, etc. Each of the foregoing modules may even besituated on a single semiconductor platform to form a graphicsprocessing unit (GPU).

In the present description, a single semiconductor platform may refer toa sole unitary semiconductor-based integrated circuit or chip. It shouldbe noted that the term single semiconductor platform may also refer tomulti-chip modules with increased connectivity which simulate on-chipoperation, and make substantial improvements over utilizing aconventional central processing unit (CPU) and bus implementation. Ofcourse, the various modules may also be situated separately or invarious combinations of semiconductor platforms per the desires of theuser.

The system 400 may also include a secondary storage 410. The secondarystorage 410 includes, for example, a hard disk drive and/or a removablestorage drive, representing a floppy disk drive, a magnetic tape drive,a compact disk drive, digital versatile disk (DVD) drive, recordingdevice, universal serial bus (USB) flash memory. The removable storagedrive reads from and/or writes to a removable storage unit in awell-known manner.

Computer programs, or computer control logic algorithms, may be storedin the main memory 404 and/or the secondary storage 410. Such computerprograms, when executed, enable the system 400 to perform variousfunctions. The memory 404, the storage 410, and/or any other storage arepossible examples of computer-readable media.

In one embodiment, the architecture and/or functionality of the variousprevious figures may be implemented in the context of the centralprocessor 401, the graphics processor 406, an integrated circuit (notshown) that is capable of at least a portion of the capabilities of boththe central processor 401 and the graphics processor 406, a chipset(i.e., a group of integrated circuits designed to work and sold as aunit for performing related functions, etc.), and/or any otherintegrated circuit for that matter.

Still yet, the architecture and/or functionality of the various previousfigures may be implemented in the context of a general computer system,a circuit board system, a game console system dedicated forentertainment purposes, an application-specific system, and/or any otherdesired system. For example, the system 400 may take the form of adesktop computer, laptop computer, server, workstation, game consoles,embedded system, and/or any other type of logic. Still yet, the system400 may take the form of various other devices including, but notlimited to a personal digital assistant (PDA) device, a mobile phonedevice, a television, etc.

Further, while not shown, the system 400 may be coupled to a network(e.g., a telecommunications network, local area network (LAN), wirelessnetwork, wide area network (WAN) such as the Internet, peer-to-peernetwork, cable network, or the like) for communication purposes.

While various embodiments have been described above, it should beunderstood that they have been presented by way of example only, and notlimitation. Thus, the breadth and scope of a preferred embodiment shouldnot be limited by any of the above-described exemplary embodiments, butshould be defined only in accordance with the following claims and theirequivalents.

What is claimed is:
 1. A method comprising: identifying a declarativerepresentation of a material to be rendered, the declarativerepresentation including expressions representing a structural part inthe material as one or more functions defining a distribution of lightas it interacts with the material; creating a reduced complexitydeclarative representation of the material by applying one or more termrewriting rules to the expressions; and returning the reduced complexitydeclarative representation of the material.
 2. The method of claim 1,wherein the declarative representation includes an expression tree or adirected acyclic graph (DAG).
 3. The method of claim 1, wherein thedeclarative representation includes an expression tree, where one ormore nodes of the expression tree each represent each represent the oneor more functions defining the distribution of light as it interactswith the material.
 4. The method of claim 1, wherein the material isrendered utilizing a physical based rendering (PBR) model.
 5. The methodof claim 1, further comprising determining an order in which the one ormore term rewriting rules are applied to the expressions.
 6. The methodof claim 1, wherein the one or more term rewriting rules are applied tothe expressions to create a sequence of declarative representations ofthe material that terminate with the reduced complexity declarativerepresentation of the material.
 7. The method of claim 1, wherein aparameter value of each of the expressions conditionally prevents amatching of each of the term rewriting rules.
 8. The method of claim 1,further comprising including annotations or other metadata associatedwith the declarative representation, where the annotations or othermetadata are used to select the one or more term rewriting rules or areused as additional parameters during the applying of the one or moreterm rewriting rules to the expressions.
 9. The method of claim 1,wherein a plurality of the term rewriting rules are applied to theexpressions in all possible orders to create a plurality of reducedcomplexity declarative representations of the material, and one of theplurality of reduced complexity declarative representations of thematerial is selected according to one or more predetermined criteria.10. The method of claim 1, wherein a plurality of term rewriting rulesare applied in a subset of all possible orders, using a predeterminedselection strategy, to create a plurality of reduced complexitydeclarative representations of the material, and one of the plurality ofreduced complexity declarative representations of the material isselected according to one or more predetermined criteria, where thepredetermined selection strategy is based on greedy selection, anarbitrary cost function, or selection criteria on which rules to applyand which ones to not apply.
 11. The method of claim 1, wherein theexpressions are traversed recursively in a depth first, left to rightorder, and the one or more term rewriting rules are matched against andapplied on a current expression of the declarative representation duringtraversal, where sub-expressions of the declarative representation aretraversed recursively after applying the one or more term rewritingrules.
 12. The method of claim 1, wherein the expressions are traversedrecursively in a depth first, left to right order, and the one or moreterm rewriting rules are matched against and applied on a currentexpression of the declarative representation only after allsub-expressions of the current expression have been traversedrecursively.
 13. The method of claim 1, further comprising determiningthe one or more term rewriting rules by: defining a plurality ofterminating expressions; creating a plurality of matching patterns forall BSDFs within the declarative representation, where the plurality ofmatching patterns enumerate all possible combinations of how theplurality of terminating expressions can show in parameters of theBSDFs; eliminating from the plurality of matching patterns those thatare equal to the plurality of terminating expressions to create aplurality of remaining patterns; and for each of the plurality ofremaining patterns, choosing a replacement expression from the pluralityof terminating expressions and defining arguments of the replacementexpression based on arguments of a match within the remaining pattern.14. A system comprising: a processor that is configured to: identify adeclarative representation of a material to be rendered, the declarativerepresentation including expressions representing a structural part inthe material as one or more functions defining a distribution of lightas it interacts with the material; create a reduced complexitydeclarative representation of the material by applying one or more termrewriting rules to the declarative representation of the material; andreturn the reduced complexity declarative representation of thematerial.
 15. The system of claim 14, wherein the declarativerepresentation includes an expression tree or a directed acyclic graph(DAG).
 16. The system of claim 14, wherein the declarativerepresentation includes an expression tree, where one or more nodes ofthe expression tree each represent the one or more functions definingthe distribution of light as it interacts with the material.
 17. Thesystem of claim 14, wherein the material is rendered utilizing aphysical based rendering (PBR) model.
 18. The system of claim 14,wherein the processor is further configured to determine an order inwhich the one or more term rewriting rules are applied to theexpressions.
 19. The system of claim 14, wherein the one or more termrewriting rules are applied to the expressions to create a sequence ofdeclarative representations of the material that terminate with thereduced complexity declarative representation of the material.
 20. Acomputer-readable storage medium storing instructions that, whenexecuted by a processor, causes the processor to perform stepscomprising: identifying a declarative representation of a material to berendered, the declarative representation including expressionsrepresenting a structural part in the material as one or more functionsdefining a distribution of light as it interacts with the material;creating a reduced complexity declarative representation of the materialby applying one or more term rewriting rules to the declarativerepresentation of the material; and returning the reduced complexitydeclarative representation of the material.